﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using YouxinHelper.Helper;
using YouxinHelper.Helper.Currency;

namespace YouxinHelper
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitView();
        }

        private void InitView()
        {
            FloderHelper.FloderExits(StaticValue.BinPath, true);
            textBox2.Text = FileHelper.ReadContextUtf8(TokenPath);
            ReflushLable();
        }

        private void ReflushLable()
        {
            Console.WriteLine("cos"+ Youxin.StaticValue.CosplayList.Count);
            Console.WriteLine("图库" + Youxin.StaticValue.PicList.Count);
            label4.Text = "cos剩余：" + Youxin.StaticValue.CosplayList.Count;
            label5.Text = "图库剩余：" + Youxin.StaticValue.PicList.Count;
        }

        static String TokenPath = StaticValue.BinPath + "Token.txt";
        private void button1_Click(object sender, EventArgs e)
        {
            Youxin.Fans.FansOperation.Start(textBox1.Text, textBox2.Text, textBox3.Text);
        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            Console.WriteLine("保存token" + textBox2.Text);
            Helper.Currency.FileHelper.WriteUtf8Text(TokenPath, textBox2.Text);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            FloderHelper.OpenFloder(".\\");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            InitScanner();
        }

        private void InitScanner()
        {
            richTextBox1.Text = "";
            textBox4.Text = "";
         
        }

        private void button4_Click(object sender, EventArgs e)
        {
      

            InitScanner();
            ReflushLable();
        }


        private void textBox5_Click(object sender, EventArgs e)
        {


            //http://ciyuanfan.baidu.com/news/get?id=150433224230090696&actionsource=5
        }

        private void richTextBox1_Click(object sender, EventArgs e)
        {
            if (this.richTextBox1 != null)
            {
                //调用Clipboard复制到粘贴板上
                Clipboard.SetText(richTextBox1.Text);

            }
            else
            {
                MessageBox.Show("复制失败");
            }
        }

        private void textBox4_Click(object sender, EventArgs e)
        {
            if (this.textBox4 != null)
            {
                //调用Clipboard复制到粘贴板上
                Clipboard.SetText(textBox4.Text);

            }
            else
            {
                MessageBox.Show("复制失败");
            }
        }




    

        private void button7_Click(object sender, EventArgs e)
        {
          
            textBox4.Text = WebSite.duowan.duowanScanner.GetTitle(textBox6.Text);
            richTextBox1.Text=   WebSite.duowan.duowanScanner.GetText(textBox6.Text);
        }

        private void button8_Click(object sender, EventArgs e)
        {
            Youxin.Local.Scanner.Start(textBox4, richTextBox1);
        }

        private void button9_Click(object sender, EventArgs e)
        {
            Youxin.Local.GetLocalList.Start(textBox4, richTextBox1);
        }

        private void button10_Click(object sender, EventArgs e)
        {
            FloderHelper.OpenFloder(".\\");
        }

        private void button3_Click_1(object sender, EventArgs e)
        {
            FloderHelper.OpenFloder("https://yx.357.com/web/publish");
        }
    }
}
